package ipcards.rulesets;
import ipcards.net.*;
import ipcards.*;
import ipcards.events.PlayerAction;

import java.util.Vector;
import java.lang.Integer;
import javax.swing.JOptionPane;


/**
 * Ruleset for Free Play.
 * This allows the player(s) to do anything they like within the ipCards engine and not be bound by any rules.
 * This is equivalent to the default state of a session in V0.1.1 and earlier
 * 
 * @author William Jarman
 */

public class FreePlayRuleSet extends Ruleset {
	
	private String deck;
	private CardsServer server;
	private FreePlayGame game;
	
	public FreePlayRuleSet(CardsServer s, FreePlayGame g){
		deck = "NoJokers.deck";
		server = s;
		game = g;
	}
	
	public void setDeck(String d){
		//needs to check if deck is valid
		deck = d;
		//updates required?
	}
	
	public String getDeckName(){
		return deck;
	}
	
	public void deal(CardSet cards){
		System.out.println("dealing"); 	
		for(Card c: cards){
			c.setFaceDown();
			c.setLocation(100,100);	
			for(Client client: server.clients) {
				//if(c.permissionQuery(client.thisplayer, server.CONTROL)) {
					c.addPermission(client.thisplayer, server.CONTROL, game.getRoom().getTable().getPlayer());
					c.addPermission(client.thisplayer, server.SEE, game.getRoom().getTable().getPlayer());
				//}
			}
		}System.out.println("aljerhfouaheygd");	
		cards.shuffle();System.out.println("aljerhfouaheygd");	
		//game.getRoom().table.sModel.performPlayerAction(new PlayerAction(game.getRoom().table.sModel, PlayerAction.SET_FACE_DOWN, cards.toString()));		

		
		
	}
}
